<?php  
	include_once("./head.php");
	include_once("./commonality.php");
	$set="select * from message m,zhuce z where m.id=z.id";
	$ever=3;
	$num=mysql_num_rows(mysql_query($set));//5
	$png=ceil($num/$ever);
	$peng=1;
	if(!isset($_GET['peng'])){
		$peng=1;
	}else{
		$peng=$_GET['peng'];
	}
	if($peng<1){
		$peng=1;
	}elseif($peng>$png){
		$peng=$png;
	}
	$start=$peng*$ever-$ever;
	$set.=" limit {$start},$ever";
	$res=mysql_query($set);
	while($list=mysql_fetch_assoc($res)){
	$sets[]=$list;
	}


?>
<!doctype html>
	<html>
	<head>
	<title>论坛</title>
	<meta charset="utf-8">
	</head>
	<style>
		.c1{
			width:500px;
			height:150px;
			border:1px solid #8a8a8a;
			margin-left:300px;

		}
		.c2{	
			width:40px;
			/*border:1px solid #8a8a8a;*/
			margin-left:400px;
			margin-top:35px;
		}
		.c3{
			width:40px;
			margin-left:450px;
			margin-top:-21px;
		}
	</style>
	<body>
	<div>
		<form action="forum1.php">
		<input type="submit" name="sub" value="发贴">
		
		</form>
	</div>
	<?php 
	 if(!empty($sets)){
	foreach($sets as $k=>$v){ ?>
		<div class="c1">
			<div>发帖人:&nbsp;&nbsp;<?= $v['name']?>&nbsp;&nbsp;<?= $v['mtime']?></div>
			<hr>
			<span>标题:&nbsp;&nbsp;<?= $v['mtitle'] ?></span><br>
			<span>内容:&nbsp;&nbsp;<?= $v['mcontent']?></span><br>
			<div class="c2"><a href="./forum2.php?mid=<?= $v['mid']?>">回复</a></div>
			<div class="c3"><a href="">删除</a></div>
		</div>
	<?php } } else {?>
			<font color='red' size=3 >未检索到数据！</font>
		<?php } ?>
		</form>
		<div align="center">
		<a href="./forum.php?peng=1">首页</a>
		<span><a href="./forum.php?peng=<?= $peng-1 ?>">上一页</a></span>
		<?= $peng ?>/<?= $png ?>
		<span><a href="./forum.php?peng=<?= $peng+1 ?>">下一页</a></span>
		<a href="./forum.php?peng=<?= $png ?>">尾页</a>
		</div>
	</body>
	</html>